package 作业;

public class 计算结果作业 {
    public static void main(String[] args) {
        //1-3+5-7+9.....-99的结果
        int num = 1,sum = 1,count = 0;
        while (sum<=99) {
            if (num % 2 ==0){
                count -= sum;
            }else {
                count += sum;
            }
            sum += 2;
            num++;
        }
        System.out.println(count);//结果为 ：-50
    }
}
